package com.miniprogram.common.enums;

import com.miniprogram.bean.vo.EnumVo;

import java.util.ArrayList;
import java.util.List;

/**
 * 分销状态
 *
 * @author lin
 * @since 2020年1月7日
 */
public enum DistributionStatusEnum {

    ADDED(1, "已增加"),
    APPLICATION_EXTRACTION(2, "申请提取"),
    EXTRACTED(3, "已提取");

    private Integer code;

    private String description;

    DistributionStatusEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static String valueOfCode(Integer code) {
        for (DistributionStatusEnum enums : DistributionStatusEnum.values()) {
            if (enums.code.equals(code)) {
                return enums.description;
            }
        }
        return "";
    }

    public static List<EnumVo> getAll() {
        List<EnumVo> list = new ArrayList<>();
        for (DistributionStatusEnum restStatusEnum : DistributionStatusEnum.values()) {
            EnumVo vo = new EnumVo();
            vo.setCode(restStatusEnum.getCode());
            vo.setDescription(restStatusEnum.getDescription());
            list.add(vo);
        }
        return list;
    }

    public static void main(String[] args) {
        System.out.println(getAll().toString());
    }


}
